<template>
  <div class="top_box cf pr" ref="top_h1" :style="{'background':bgcolor}" :class="is_boxshadow?'':'no_shadow'">
    <template>
      <template>
        <button class="back_btn fl"
          @click="back">返回</button>
      </template>
      <h1 class="top_title">{{title}}</h1>
    </template>
  </div>
</template>

<script>
  export default {
    name: 'topTitle',
    data() {
      return {

      }
    },
    props: {
        //这里是组件可以接受的参数，也就是相当于面向原型写组件时的配置参数，用户可以传递不同参数，自己定义组件
        bgcolor:{
            type: String,//数据类型
            default: '#ffffff',//默认值
        },
        title:{
            type: String,//数据类型
            default: '',//默认值
        },
        is_boxshadow:{
            type: Boolean,//数据类型
            default: false,//默认值
        },
    },
    mounted() {

    },
    methods: {
      back(){
          this.$emit("go_back", '');
      }
    }
  }
</script>

<style scoped>
  .top_box {
    padding: 0 20px;
    height: 50px;
    /* background: #F7FAFF; */
    color: #21263f;
    font-size: 16px;
    box-shadow: 0 1px 0 0 #E8EFF4;
  }

  .no_shadow{
     box-shadow:none;
  }

  .top_box h1.top_title {
    width: 100%;
    height: 50px;
    color: #354168;
    text-align: center;
    font-weight: 700;
    font-size: 16px;
    line-height: 50px
  }

  .back_btn {
    position: absolute;
    top: 10px;
    left: 20px;
    box-sizing: border-box;
    padding-left: 23px;
    width: 60px;
    height: 30px;
    border: 1px solid #dddee1;
    border-radius: 2px;
    background: url('~@/assets/images/tx_answer/accessRecord/fanhui.png') no-repeat 13px center transparent;
    background-size: 5px 10px;
    color: #354168;
    text-align: left;
    font-size: 12px;
    line-height: 30px;
    cursor: pointer;
    transition:0.2s;
  }
  .back_btn:hover{
    background: url('~@/assets/images/tx_answer/accessRecord/fanhui.png') no-repeat 13px center #fff;
    background-size: 5px 10px;
    box-shadow: 0 0 4px #0003;
  }
</style>
